﻿using System;
using System.Collections.Generic;
using Shuriken.Base; 

namespace Shuriken.Core.Store
{
    public class QNScanner : IScanner 
    {
        private IScanner scan;
        private bool registered = false; 

        public QNScanner(IScanner scanner)
        {
            scan = scanner; 
        }
        #region IScanner Members

        public List<ISubject> Items
        {
            get { return GetListOfQNItems();  }
        }

        private List<ISubject> GetListOfQNItems()
        {
            List<ISubject> list = new List<ISubject>();

            foreach (ISubject item in scan.Items)
            {
                QNStoreItem qnItem = new QNStoreItem(item);
                list.Add(qnItem);

                if (!registered)
                {
                    qnItem.RegisterActions();
                }
            }

            registered = true; 
            return list; 
        }

        public void Update()
        {
            scan.Update();
        }

        #endregion

        #region IObject Members

        public string Name
        {
            get { return scan.Name; }
        }

        public string Description
        {
            get { return scan.Description; }
        }

        public string Icon
        {
            get
            {
                return scan.Icon; 
            }
            set
            {
                scan.Icon = value; 
            }
        }

        #endregion
    }
}
